#include <bits/stdc++.h>
using namespace std;

class Solution {
    public:
        int jump(vector<int>& nums) {
            int size = nums.size();
            int *dp = new int[size]{0};
            for(int i=0; i<size; ++i){
                for(int j=1; j<=nums[i]; ++j){
                    if(i+j>size-1) break;
                    if(dp[i+j]==0) dp[i+j] = dp[i] + 1;
                    else dp[i+j] = min(dp[i+j], dp[i]+1);
                }
            }
            int ans = dp[size-1];
            delete[] dp;
            return ans;
        }
    };

int main(){

}